#Include DrawQueue.ahk
#Include CtrlPalette.ahk
#Include ToolUIBase.ahk

class TextSubMenu extends BaseToolUI {

  w := 151, h := 32
  s := 3

  __New(x, y, mgr) {
    this.x := x, this.y := y, this.mgr := mgr
    overlay := ShinsOverlayClass(x, y, this.w, this.h, 1, 0, 0)
    this.overlay := overlay

    me := MouseEvent(overlay.gui.Hwnd)

    q := DrawQueue(overlay)
    q.Register(ObjBindMethod(this, 'Refresh'))
    this.q := q
    this.p := Palette(0, 5, me, overlay, q)
  }

  Show() => (this.overlay.gui.Restore(), this.q.Update())
  Hide() => this.overlay.gui.Hide()
  Move(x, y) => this.overlay.gui.Move(x, y)
  Destroy() => this.overlay.gui.Destroy()

  Refresh(overlay) {
    overlay.FillRectangle(0, 0, this.w, this.h, '0xff073d33')
    overlay.DrawRectangle(1, 1, this.w - 1, this.h - 1, '0xff01ffe1')

    this.mgr.GetHandlerIns().UpdateParam(this.p.c + (0xFF << 24))
  }
}